package my.framework.dubbo.sample.user.controller;

import com.alibaba.dubbo.config.annotation.Reference;
import my.framework.dubbo.sample.model.user.UserDO;
import my.framework.dubbo.sample.service.user.UserService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author xuexue
 * @date 2018/11/14 23:24
 */
@RestController
public class UserController {
    @Reference
    private UserService userService;

    @RequestMapping("getUser")
    public UserDO getUser(@RequestParam(required = false, defaultValue = "1") Integer id) {
        return userService.queryUser(new UserDO(id));
    }
}
